<?php

if(! defined('OT_ROOT')) {
	exit('Access Denied');
}


class AppIdcServ{
	public static $appName = 'IDC主控模块';
	public static $appID = 119;

	public static function Jud(){
		return false;
	}

	public static function Show($str, $def=''){
			return $def;
	}

	public static function XingwaiServItem(){

	}

	public static function ReqApi($apiType, $type, $url, $key, $dataArr){
		return array('res'=>false, 'note'=>'该插件未购买');
	}

	public static function ApiResToArr($apiType, $str){
		$retArr = array('ori' => $str);

		return $retArr;
	}

	public static function State($num, $mode=''){
		switch ($num){
			case 12:	return $mode=='cn'?'试用中':'<span style="color:blue;">试用中</span>';
			case 10:	return '正常';
			case 9:		return $mode=='cn'?'已退款':'<span style="color:red;">已退款</span>';
			case 6:		return $mode=='cn'?'开通失败':'<span style="color:red;">开通失败</span>';
			case 3:		return $mode=='cn'?'未安装系统':'<span style="color:green;">未安装系统</span>';
			case 0:		return $mode=='cn'?'停止':'<span style="color:red;">停止</span>';
			default :	return '['. $num .']';
		}
	}

	public static function GetServArr($proRow, $mode=''){
		$retArr = array();

		return $retArr;
	}

	public static function GetServItem($proRow, $servID, $mode=''){
		global $DB;

		$retArr = array($servID => array('jud'=>true, 'id'=>$servID, 'state'=>$servID, 'note'=>''));
		return $retArr;
	}

	public static function GetOsArr($servID, $mode=''){
		$retArr = array();
		return $retArr;
	}

	public static function AddData($sqlArr=array(), $mode=''){

	}

	public static function PayPrice($payMode, $dataArr){
		$price = 99999;
		return $price;
	}

	public static function PayCost($payMode, $dataArr){
		$price = 99999;
		return $price;
	}

	public static function GetVhdPath($vhdPath, $vpsName){
		return $vhdPath . $vpsName .'.vhdx';
	}

	public static function GetOsUserArr($osPoint, $osID, $servRow){
		global $DB;

		$vpsPort	= '3389';
		$vpsUser	= 'administrator';
		$osType		= 'Windows';
		$osName		= '';
		$osPath		= '';

		$retArr = array(
			'user'		=> $vpsUser,
			'port'		=> $vpsPort,
			'osType'	=> $osType,
			'osName'	=> $osName,
			'osPath'	=> $osPath
			);

		return $retArr;
	}

	public static function GetOsIpArr($type, $whereStr, $servRow){
		global $DB;

		$ipList = $mac = '';
		$ip = $ipmask = $ipgateway = $ipdns1 = $ipdns2 = 0;
		$ip2 = $ip2mask = $ip2gateway = $ip2dns1 = $ip2dns2 = 0;

		$retArr = array(
			'ip'		=> $ip,
			'ipmask'	=> $ipmask,
			'ipgateway'	=> $ipgateway,
			'ipdns1'	=> $ipdns1,
			'ipdns2'	=> $ipdns2,
			'ip2'		=> $ip2,
			'ip2mask'	=> $ip2mask,
			'ip2gateway'=> $ip2gateway,
			'ip2dns1'	=> $ip2dns1,
			'ip2dns2'	=> $ip2dns2,
			'mac'		=> $mac,
			'ipList'	=> $ipList
			);

		return $retArr;
	}

	public static function GetVpsParaArr($servID,$eventStr=''){
		return array('ipNum0'=>-1, 'ramTotal'=>-1, 'diskTotal'=>-1, 'vpsNum'=>-1);
	}

	public static function GetRndIpArr($servID, $maxNum=1){
		return array('res'=>true, 'note'=>'', 'ipNum'=>0, 'ipIdArr'=>array(), 'ipStrArr'=>array());
	}

	public static function TypeArr($str=''){
		$retArr = array(
			'kaitong'		=> '开通',
			'xufei'			=> '续费',
			'shengji'		=> '升级',
			'suff'			=> '充值',
			'setTime'		=> '调整时间',
			'genghuan'		=> '更换',
			);
		if ($str == 'key'){
			return array_keys($retArr);
		}else{
			return $retArr;
		}
	}

	public static function TypeCN($str, $def=null){
		$arr = self::TypeArr();
		if (isset($arr[$str])){
			return $arr[$str];
		}else{
			if ($def == null){
				return '['. $str .']';
			}else{
				return $def;
			}
		}
	}

	public static function UsersItem($userID, $color='red'){

	}

	public static function UserInfo($dataID, $mode='api'){
		return array('res'=>false,'note'=>'idcServ插件未购买');
	}
}
?>